import { lazy } from "react";
import {createBrowserRouter, Navigate} from "react-router-dom"
import Zhu from "../pages/Zhu/Zhu";

let Home=lazy(()=> import("../pages/Home/Home"));
let Login=lazy(()=> import("../pages/Login/Login"));
let List=lazy(()=> import("../pages/List/List"));
let Charts=lazy(()=> import("../pages/Charts/Charts"));
let Table=lazy(()=> import("../pages/Table/Table"));
let I18n=lazy(()=> import("../pages/i18n/Index"));

export const homeRoutes=[
    {
        path:"/zhu/home",
        element:<Home></Home>,
        title:"首页"
    },
    {
        path:"/zhu/list",
        element:<List></List>,
        title:"列表"
    },
    {
        path:"/zhu/charts",
        element:<Charts></Charts>,
        title:"图表"
    },
    {
        path:"/zhu/table",
        element:<Table></Table>,
        title:"表格",
        children:[
            {
                path:"/zhu/table/i18n",
                element:<I18n></I18n>,
                title:"翻译",
            }
        ]
    },
]

let routes=createBrowserRouter([
    {
        path:"/",
        element:<Navigate to={"/zhu"}></Navigate>
    },
    {
        path:"/zhu",
        element:<Zhu></Zhu>,
        children:homeRoutes
    },
    {
        path:"/login",
        element:<Login></Login>
    }
])
export default routes